package org.midi.j2me.midlet;

import javax.microedition.lcdui.Display;
import javax.microedition.midlet.MIDlet;
import javax.microedition.midlet.MIDletStateChangeException;

import org.midi.j2me.component.Logo;
import org.midi.j2me.component.MainCanvas;
import org.midi.j2me.component.ImageLib;
import org.midi.j2me.component.ProgressBar;
import org.midi.j2me.util.AsyncProcessor;

public class LogoMIDlet extends MIDlet {

	public Display display;

	public MainCanvas canvas;

	private Logo logo;

	private ProgressBar progressBar;

	public AsyncProcessor sync;
	public LogoMIDlet() {
		sync = new AsyncProcessor(1);
		display = Display.getDisplay(this);
		canvas = new MainCanvas(this);

		progressBar = new ProgressBar();
		progressBar.initialize(240, 10, 0, 0, 0xFF00FF, 0x00FF00);
		logo = new Logo(this, ImageLib.getInstance().imgLogo, progressBar);
	}

	protected void startApp() throws MIDletStateChangeException {
		display.setCurrent(logo);
	}

	protected void pauseApp() {
		// TODO Auto-generated method stub

	}

	public void destroyApp(boolean b) throws MIDletStateChangeException {
		if(!b){
			throw new MIDletStateChangeException();
		}else{
			notifyDestroyed();
		}

	}

}
